# @Desc    : do what 
# @Author  : meihongliang  
# @Time    : 2025-03-17 23:49
from jqdatasdk import *

auth('13752935158', 'Q8565418mhl')


def save_all_stock_to_excel():
    df = get_all_securities()
    print(len(df))
    # print(df[:2])
    # 保存到指定工作表，并从第2行第2列开始写入
    df.to_excel('all_type.xlsx', sheet_name='Sheet1', startrow=1, startcol=1)


def main():
    print('JQData...试用账号历史范围：前15个月~前3个月...')
    last_count = get_query_count()
    print(f'剩余spare数量: {last_count['spare']}')
    print(get_account_info())
    # stock 只股票
    # payh = get_security_info('000001.XSHE', date='2017-08-31')
    # print(payh)
    # q = query(finance.STK_STATUS_CHANGE).filter(finance.STK_STATUS_CHANGE.code == '000001.XSHE').limit(10)
    # df = finance.run_query(q)
    # print(df)
    xx = get_price(security=['000001.XSHE', '000034.XSHE'], start_date='2023-12-09', end_date='2024-12-15')
    print(xx)


if __name__ == '__main__':
    main()
